Component({
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    title: {
      type: String,
      value: '请选择'
    },
    items: {
      type: Array,
      value: []
    }
  },

  data: {
    animationData: {}
  },

  methods: {
    onItemTap(e) {
      const { index } = e.currentTarget.dataset;
      this.triggerEvent('select', {
        index,
        item: this.data.items[index]
      });
      this.onClose();
    },

    onClose() {
      this.triggerEvent('close');
    },

    showActionSheet(options = {}) {
      const { title, items } = options;
      this.setData({
        show: true,
        title: title || this.data.title,
        items: items || this.data.items
      });
    }
  }
}); 